package cn.rui.common;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author 徽州大都督
 * @date 2021/6/8
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "返回信息封装类",value = "返回信息封装类")
public class ResponseBean {

    @ApiModelProperty(value = "状态码")
    private Integer statusCode;

    private String message;

    private Object data;

    public static ResponseBean success(String message){
        return new ResponseBean (200,message,null);
    }

    public static ResponseBean success(String message,Object data){
        return new ResponseBean (200,message,data);
    }

    public static ResponseBean error(String message){
        return new ResponseBean (404,message,null);
    }

    public static ResponseBean error(String message,Object data){
        return new ResponseBean (404,message,data);
    }
    public static ResponseBean error(String message,Integer statusCode){
        return new ResponseBean (statusCode,message,null);
    }
}
